Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polylabel

Package Overview
Dependencies
Maintainers
15
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polylabel

A JS library for finding optimal label position inside a polygon

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
189K
decreased by-4.47%
Maintainers
15
Weekly downloads
 
Created

What is polylabel?

The polylabel npm package is used to find the pole of inaccessibility of a polygon, which is the most distant internal point from the polygon's edges. This is useful for placing labels on polygons in a way that maximizes readability and avoids overlap with the edges.

What are polylabel's main functionalities?

Finding the pole of inaccessibility

This feature allows you to find the pole of inaccessibility for a given polygon. The code sample demonstrates how to use the polylabel function to find the optimal label position within a square polygon.

const polylabel = require('polylabel');
const polygon = [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]];
const precision = 1.0;
const labelPosition = polylabel(polygon, precision);
console.log(labelPosition); // Outputs: [5, 5]

Other packages similar to polylabel

FAQs

Package last updated on 19 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc